<div ng-controller="Supplier_WarehouseEntrysC">
    <div class="bg-light lter b-b wrapper-md">
        <h1 class="m-n font-thin h3">入库单列表</h1>
    </div>
    <div class="wrapper-md" style="text-align: right;">
        <div class="panel panel-default">
            <div class="panel-heading">
                <button type="button" class="btn btn-default" ng-click="goorderList()">返回</button>
            </div>
            <div class="table-responsive text-center" >
                <table id="example1" class="table table-striped b-t b-light">
                    <thead>
                    <tr>
                        <th style="text-align: center;">创建人</th>
                        <th style="text-align: center;">创建时间</th>
                        <th style="text-align: center;">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="item in pageData.Data">
                        <td style="width: 33%">{{item.Creater.Name}}</td>
                        <td style="width: 33%">{{item.CreateTime}}</td>
                        <td style="width: 34%">
                            <button class="btn btn-sm btn-default" ng-click="$state.go('app.Depot_MoreWarehouseEntrys', { 'id': item.Id })">
                                <i class="fa fa-plus text"></i>
                                <span class="text">详情</span>
                            </button>
                        </td>
                    </tr>
                    </tbody>
                </table>
               <!--<div class="row text-center">
                    <div class="panel-heading" my-pagination get-page-data="getData" mypagedata="pageData"></div>
                </div>-->
                <div class="panel-heading" my-pagination get-page-data="getData" mypagedata="pageData"></div>
            </div>
        </div>
    </div>
</div>
<script>
    angular.module('app')//非标优惠
            .controller("Supplier_WarehouseEntrysC", function ($scope, $state, $http, $stateParams,toSave) {
                $scope.id = $stateParams.id;
                $scope.pageData = {};
                $scope.pageData.Page = 1;
                if($stateParams.num == 0){
                    $scope.myurl2 = 'app.TraderManage_List';
                } else if ($stateParams.num == 1) {
                    $scope.myurl2 = 'app.Warehouse_List';
                } else {
                    $scope.myurl2 = 'app.Provider_List';
                }
                $scope.pageData.Rows = $scope.defPageRows;
                //
                $scope.getData = function (p, r) {
                    if (p) {
                        p = p < 1 ? 1 : p;
                    } else p = 1;
                    if (r) {
                    } else r = $scope.defPageRows;
                     toSave.save_pages_lis(p,r);//保存当前页码和条数
                    console.log(toSave.get_pages(),toSave.get_lis());
                    $http({
                        url: "../api/Provider/GetWarehouseEntrys?providerId=" + $scope.id + "&page=" + p + "&rows=" + r,
                        method: "GET"
                    })
                            .then(function (res) {
                                // console.log(pageData)
                                $scope.pageData = res.data;
                                console.log($scope.pageData);
                            })
                            .then(function (error) {
                                if (error) {
                                    alert("数据获取失败");
                                }
                            });
                };
                $scope.getData(toSave.get_pages(), $scope.pageData.Rows);
                //返回仓库列表
                $scope.goorderList = function () {
                    $state.go($scope.myurl2)
                };
            })

</script>
<script src="js/services/toSave.js"></script>

